<?
/* @author Udo Schroeter <udo.schroeter@gmail.com>
 * @license dual license: LGPL / commercial use license
 */ 

  function actorTextStory($text, $actor = 'You', $xparams = array())
  {
    $r = array(); $w = array();
    $xparams['actor'] = $actor;
    foreach($xparams as $k => $v)
    {
      $r[] = '$'.$k;
      $w[] = $v;
    } 
    return(trim(str_replace($r, $w, $text)));
  }
  
  function makePlural($singular, $number = 1)
  {
    if ($number == 1) return($singular);
    if (substr($singular, -1) == 's')
     return($singular);
    if (substr($singular, -1) == 'y' && strtolower(substr($singular, -4))!=' key')
      return(substr($singular, 0, -1).'ies');
    else
      return($singular.'s');
  }
  
  function toolTip($l10nkey)
  {
    if (substr($l10nkey, 0, 1) == ':')
    {
      $text = substr($l10nkey, 1);
    }
    else
      $text = AGController::l10n($l10nkey, 'cq', 'en');
    return(' 
      onMouseover="fixedtooltip(\''.str_replace("'", "\\'", $text).'\', this, event, \'150px\')" 
      onMouseout="hidetip()"');
  }

?>